const { BaseTexture, Texture } = PIXI;
function loadBase64(img, prefix=true) {
    return new Promise((resolve) => {
        let image = new Image();
        if (prefix) {
            image.src = `data:image/gif;base64,${img}`
        } else {
            image.src = img;
        }
        image.onload = function() {
            resolve(image);
        }
    })
}

function imageToTexture(image) {
    const baseTexture = new BaseTexture(image);
    const texture = new Texture(baseTexture);
    return texture;
}

/**
 * 
 * @param {string} _name 
 * @returns {string}
 */
 function sequilizeSE(_name) {
    const name = _name.trim();
    const l = name.slice(1);
    let res = name[0].toLowerCase();
    for (let s of l) {
        if (/[A-Z]/.test(s)) {
            res += `-${s.toLowerCase()}`;
        } else {
            res += s;
        }
    }
    return res; 
}